import { _decorator, Component, Node, Prefab } from 'cc';
const { ccclass, property } = _decorator;

@ccclass('AutoDestroy')
export class AutoDestroy extends Component {

    // @property(Prefab)
    // public bulletPrefab:Prefab = null; // 子弹预制体
    start() {

    }

    update(deltaTime: number) {
        const pos = this.node.position; // 获取子弹位置
        if(pos.y < -10){

            this.node.destroy(); // 销毁节点
        }
        
    }
}


